// src/services/user.ts
import { Injectable } from "@nestjs/common";
import { InjectRepository } from "@nestjs/typeorm";
import { Repository } from "typeorm";
import { User } from "../entities/user";

@Injectable()
export class UserService {
  constructor(
    @InjectRepository(User)
    private readonly userRepository: Repository<User>
  ) {}

  async queryList() {
    try {
      return await this.userRepository.findAndCount();
    } catch (error) {
      console.error("Error in queryList:", error); // 添加详细的错误日志
      throw error; // 抛出错误以便在控制器中捕获
    }
    
  }
}
